import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
//class CareerCheckBox
    
    export  class CareerCheckBox /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initUI();
            addEventListener(flash.events.MouseEvent.MOUSE_OVER, this.onMouseOverHandler);
            return;
        }

        /* internal  */onMouseOverHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            addEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseOutHandler);
            if (this._bgUpSkin.parent) 
            {
                this._bgUpSkin.parent.removeChild(this._bgUpSkin);
            }
            if (!this._bgOverSkin.parent) 
            {
                this._bgBody.addChild(this._bgOverSkin);
            }
            return;
        }

        /* internal  */onMouseOutHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            removeEventListener(flash.events.MouseEvent.MOUSE_OUT, this.onMouseOutHandler);
            if (this._bgOverSkin.parent) 
            {
                this._bgOverSkin.parent.removeChild(this._bgOverSkin);
            }
            if (!this._bgUpSkin.parent) 
            {
                this._bgBody.addChild(this._bgUpSkin);
            }
            return;
        }

        /* internal  */onCareerResLoaded(): void
        {
            this._bgOverSkin.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerCheckBox_overSkin);
            this._bgUpSkin.bitmapData = GlobalClass.getBitmapData(ImagesConst.careerCheckBox_upSkin);
            return;
        }

        /* internal  */onFrontResLoaded(): void
        {
            this._frontSkin.bitmapData = GlobalClass.getBitmapData(this._frontName);
            return;
        }

        protected initUI(): void
        {
            this._bgBody = new Object /* flash.display.Sprite */();
            this._frontBody = new Object /* flash.display.Sprite */();
            this._frontBody.x = 4;
            this._frontBody.y = 4;
            this._bgOverSkin = new Object /* flash.display.Bitmap */();
            this._bgUpSkin = new Object /* flash.display.Bitmap */();
            this._frontSkin = new Object /* flash.display.Bitmap */();
            this._bgBody.addChild(this._bgUpSkin);
            this._frontBody.addChild(this._frontSkin);
            addChild(this._bgBody);
            addChild(this._frontBody);
            LoaderHelp.addResCallBack(ResFileConst.careerChange, this.onCareerResLoaded);
            return;
        }

        public updateFrontSkin(arg1: string, arg2: string=null): void
        {
            this._frontName = arg1;
            if (arg2) 
            {
                LoaderHelp.addResCallBack(arg2, this.onFrontResLoaded);
            }
            else 
            {
                this._frontSkin.bitmapData = GlobalClass.getBitmapData(arg1);
            }
            return;
        }

        /* internal */ /* var */_bgBody: Object /* flash.display.Sprite */;

        /* internal */ /* var */_bgOverSkin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bgUpSkin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_frontBody: Object /* flash.display.Sprite */;

        /* internal */ /* var */_frontSkin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_frontName: string;
    }
